var win = Titanium.UI.currentWindow;
win.backgroundColor = '#13386c';
win.barColor = '#13386c';

var picker = Ti.UI.createPicker();

var data = [];
data[0] = Ti.UI.createPickerRow({ title: 'Trop Bon', custom_item: 'b' });
data[1] = Ti.UI.createPickerRow({ title: 'Excelent', custom_item: 's' });
data[2] = Ti.UI.createPickerRow({ title: 'Mauvais', custom_item: 'm' });
data[3] = Ti.UI.createPickerRow({ title: 'Impossible a manger', custom_item: 'g' });

// turn on the selection indicator (off by default)
picker.selectionIndicator = true;

picker.add(data);

win.add(picker);

picker.setSelectedRow(0, 1, true);

var label = Ti.UI.createLabel({
    text: 'Changer la selection',
    top: 6,
    width: 'auto',
    height: 'auto',
    textAlign: 'center',
    color: 'white'
});
win.add(label);

var button = Ti.UI.createButton({
    title: 'Mettre a Excelent',
    top: 34,
    width: 200,
    height: 30
});
win.add(button);

button.addEventListener('click', function () {
    // column, row, animated (optional)
    picker.setSelectedRow(0, 1, true);
});

picker.addEventListener('change', function (e) {
    Ti.API.info("Vous avez choisi: " + e.row + ", column: " + e.column + ", custom_item: " + e.row.custom_item);
    label.text = "row index: " + e.rowIndex + ", column index: " + e.columnIndex;
});

picker.setSelectedRow(0, 1, false);
